import BpmnProcessDesigner from "./designer";
import BmpnProcessPenal from "./penal";

import ProcessDesigner from "../ProcessDesigner";
import ProcessViewer from "../ProcessViewer";

import render from "../form/render/render";
import parser from "../form/parser"
import FormBuilder from "../form/build";

const components = [ProcessDesigner, ProcessViewer, render, parser]
const install = function (Vue, opts = {}) {
  Object.keys(components).map(ele => {
    let component = components[ele];
    let name = component.name || '';
    name = name.substr(name.length - 1, 1) === '-' ? (name.substr(0, name.length - 1)) + ele : name;
    Vue.component(name, component);
  });
}
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue);
  window.FormBuilder = FormBuilder;
}

export {
  FormBuilder,
  BpmnProcessDesigner,
  BmpnProcessPenal
}
